import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
import {getUserInfo}  from '@/api/user'
      const useInfo = defineStore('userInfo', {
  state: () => {
      return {
          avatar: '',//头像
          sex:0,//性别，
          sign:'',//简介
          name:''//姓名
      }
  },
  actions:{
      setUserInfo(data){
          this.avatar=data.avatar
          this.sex=data.sex
          this.sign=data.sign
          this.name=data.name
      },
     async getUserInfo(){
        let data = (await getUserInfo()).data
        this.avatar=data.avatar
          this.sex=data.sex
          this.sign=data.sign
          this.name=data.name
      }
  }
})

export default useInfo
